<%-- 
    Document   : themcathi
    Created on : Sep 17, 2012, 12:17:03 AM
    Author     : Odotube
--%>

<%@page import="thitracnghiem.Lop"%>
<%@page import="java.util.ArrayList"%>
<%@page import="thitracnghiem.MonThi"%>
<%@page import="thitracnghiem.GiaoVien"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%@include file="/menuad.html"%>
        <%

            session = request.getSession();
            GiaoVien gv = (GiaoVien) session.getAttribute("gv");
            if (gv == null) {
                response.sendError(403);
                return;
            } else if(!gv.getUsername().equals("admin")){
                response.sendError(403);
                return;
            }
            
        %>
        <form action="/ThiTracNghiem/XuLy" method="post">
            <%
                String s = "";                
                s = request.getParameter("tb");
                if (s == null) {
                    s = "";
                }
                MonThi.Open();
                ArrayList<MonThi> dsMonThi = MonThi.getDSMonThi();
                MonThi.Close();
                s += "Mon thi: <select name=mamonthi>";
                for (int i = 0; i < dsMonThi.size(); i++) {
                    s += "<option value=" + dsMonThi.get(i).getMaMonThi() + ">" + dsMonThi.get(i).getTenMonThi();
                }
                s += "</select><br>";
                Lop.Open();
                ArrayList<String> dsLop=Lop.getDSCacLop();
                Lop.Close();
                s += "Lop: <select name=lop>";
                for (int i = 0; i < dsLop.size(); i++) {
                    s += "<option value=" + dsLop.get(i) + ">" + dsLop.get(i);
                }
                s += "</select><br> Lan thi: <input type='text' name='lanthi'><br>";
                out.println(s);
            %>
            Ngay thi: <input type="text" name="ngaythi"><br>
            Thoi gian bat dau:  <input type="text" name="tgbatdau"><br>
            Thoi gian ket thuc: <input type="text" name="tgketthuc"><br>
            So cau hoi: <input type="text" name="socauhoi"><br>
            <input type="hidden" name="yc" value="themcathi">
            <input type="submit" name="xacnhan" value="Them">
            <input type="submit" name="xacnhan" value="Khong">
        </form>
    </body>
</html>
